package com.itheima.service.feignClient;

import com.itheima.domain.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @ClassName ProductService
 * @Description TODO
 * @Date 2023/7/25 15:22
 * @Version 1.0
 */
// value 用于指定调用 Nacos 下的微服务名词
@FeignClient(value = "service-product", fallback = ProductServiceFallback.class)
public interface ProductServiceClient {

    /*
        @FeignClient 的 value + @RequestMapping 的 value 值其实就是完整的请求地址:
        "http://service-product/product/" + pid
    */
    @RequestMapping("/product/{pid}")
    Product findByPid(@PathVariable Integer pid);
}
